package com.sporch.feign;

import com.czy.model.UserInfo;
import com.sporch.feign.service.SchedualServiceHiHystric;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author czy
 * @date 2019/5/30
 * @FeignClient(name="service-hi")  实现远程调用
 * name="service-hi" 指定要调用的服务的名称
 * fallback = SchedualServiceHiHystric.class
 */
@FeignClient(name="service-hi",fallback = SchedualServiceHiHystric.class)
public interface RemoteService {
    /**
     * 注意事项
     * 1、feignClient接口 有参数在参数必须加@PathVariable("XXX")和@RequestParam("XXX")
     * 2、feignClient返回值为复杂对象时其类型必须有无参构造函数。
     * @param name
     * @return
     */
    @RequestMapping("/hehe")
    public String remoteMethod(@RequestParam("name") String name);

    @RequestMapping("/hehe2")
    public String remoteMethod2(@RequestBody UserInfo userInfo);
}
